<extend name="./app/Tpl/Public/template.html" />
<block name="content_body">
	<div class="pad-lr-10">
	    <div style="padding:10px; overflow:hidden;">
	    	<div class="main_top" style="clear:both;"><h4>温馨提示：</h4>
    			<ul>
    				<li class="green">1.管理员具有后台的全部权限，店长只能管理自己的店铺，</li>
    				<li class="green">2.店员只能查看商品和订单，配送员只能查看自己的订单信息</li>
    			</ul>
	    	</div>
	    </div>
	    <form name="form_edit" id="form_edit" action="{:U('doUpd')}" method="post">
	    	<input type="hidden" name="id" id="id" class="input-text-long" value="{$detail.id}" >
	        <table width="100%" cellpadding="2" cellspacing="1" class="table_form">
	            <tr>
	                <th width="100"><span class="required">*</span>姓名:</th>
	                <td width="300">
	                	<input type="text" name="name" id="name" class="input-text-long" value="{$detail.name}" >
	                </td>
	                <td><div id="nameTip"></div></td>
	            </tr>
	            <tr>
	                <th><span class="required">*</span>性别:</th>
	                <td>
	                	<input type="radio" name="sex" id="sex_1" value="男">男&nbsp;&nbsp;&nbsp;
	                	<input type="radio" name="sex" id="sex_0" value="女">女
	                </td>
	                <td><div id="sexTip"></div></td>
	            </tr>
	            <tr>
	                <th width="100"><span class="required">*</span>店铺:</th>
	                <td width="300">
	                	<select name="shop_id" id="shop_id" style="width:210px;" class="chosen_search">
							<option value="">选择负责店铺</option>
               				<volist name="shopList" id="val">
						    	<option value="{$val.id}"  <if condition="$val['id'] eq $search['shop_id']">selected</if>>{$val.title}</option>
               				</volist>
						</select>
	                </td>
	                <td><div id="shop_idTip"></div></td>
	            </tr>
	            <tr>
	                <th width="100"><span class="required">*</span>职务:</th>
	                <td width="300">
	                	<select name="role_name" id="role_name" style="width:210px;" class="chosen_search">
							<option value="">选择店铺职责</option>
               				<volist name="roleList" id="val">
						    	<option value="{$val.name}"  <if condition="$val['name'] eq $search['role_name']">selected</if>>{$val.title}</option>
               				</volist>
						</select>
	                </td>
	                <td><div id="role_nameTip"></div></td>
	            </tr>
	           	<tr>
	                <th><span class="required">*</span>手机:</th>
	                <td>
	                	<input type="text" name="mobile" id="mobile" class="input-text-long" value="{$detail.mobile}"  >
	                </td>
	                <td><div id="link_wayTip"></div></td>
	            </tr>
	            <tr>
	                <th><span class="required">*</span>就职日期:</th>
	                <td>
	                	<input type="text" name="start_date" id="start_date" class="input-text-long" value="{$detail.start_date}" >
	                </td>
	                <td><div id="start_dateTip"></div></td>
	            </tr>
	            <tr>
	                <th><span class="required">*</span>登录帐号:</th>
	                <td>
	                	{$detail.account}
	                </td>
	                <td><div id="accountTip"></div></td>
	            </tr>	            
	            <tr>
	                <th><span class="required">*</span>登录密码:</th>
	                <td>
	                	<input type="text" name="password_char" id="password_char" class="input-text-long" value="{$detail.password_char}" >
	                </td>
	                <td><div id="password_charTip"></div></td>
	            </tr>
	            <tr>
	            	<th width="100"><span class="required">*</span>员工备注:</th>
	                <td colspan="2">
	                	<textarea id="content" name="content" cols="30" rows="10">{$detail.content} </textarea>
	                </td>
	            </tr>
	            <tr>
		            <td colspan="3">
			            <div class="explain-col">
			            	<input type="button" name="submitBtn" id="submitBtn" value="保存" onclick="doSubmit()">
	        				<input type="button" name="reset" value="返回列表" onclick='redirect("{:U('index')}")'>
	        				<input type="button" name="delBtn" id="delBtn" value="删除" onclick="doDel('{:U('doDel',array('id'=>$detail['id']))}')">
			        	</div>
		            </td>
	            </tr>
	        </table>
	    </form>
	</div>
<script type="text/javascript" src="__ROOT__/statics/scripts/kindeditor/kindeditor-all-min.js"></script>
<script type="text/javascript" src="__ROOT__/statics/scripts/jquery/jquery.ui.datepicker-zh.js"></script>
<script type="text/javascript">

function doSubmit(){
	$('#form_edit').submit();
}
$(function(){
	$.datepicker.setDefaults( $.datepicker.regional[ "zh" ] );
	$( "#start_date" ).datepicker({
		dateFormat:'yy-mm-dd',
		changeYear: true,
		onClose:function(){
			$(this).blur();
		}
	});
	
	$.formValidator.initConfig({
		formID:"form_edit",
		wideWord:false,
		submitOnce:true
	});
	
	var tips = {
		"nameTip":"请输入员工姓名",
		"sexTip":"请输入员工性别",
		"shop_idTip":"请选择店铺",
		"role_nameTip":"请选择职务",
		"start_dateTip":"请输入就职日期",
		"mobileTip":"请输入联系方式",
		"accountTip":"请输入帐号",
		"password_charTip":"请输入密码"
	}
	$("#name").formValidator({
		onFocus:tips.nameTip,
	}).inputValidator({
		min:2,
		max:50,
		onError:"请输入2-50个汉字或字符"
	});
	
	$(":radio[name='sex']").formValidator({
			tipID:"sexTip",
			defaultValue:['{$detail.sex}'],
			onFocus:tips.sexTip
		}).inputValidator({
			min:1,
			onError:tips.sexTip
		});
	
	$("#shop_id").formValidator({
		onFocus:tips.shop_idTip,
	}).inputValidator({
		min:1,
		onerror: "请选择负责的店铺"
	});
	
	$("#role_name").formValidator({
		onFocus:tips.role_nameTip,
	}).inputValidator({
		min:1,
		onerror: "请选择职务"
	});

	
	$("#start_date").formValidator({
		onFocus:tips.start_dateTip,
	}).inputValidator({
		type:"date",
		onError:"截至日期格式不正确"
	});
	
	$("#link_way").formValidator({
		onFocus:tips.link_wayTip,
	}).inputValidator({
		min:2,
		max:50,
		onError:"联系方式不正确（2-50个字符）"
	});
	
	$("#password_char").formValidator({
		onFocus:tips.password_charTip,
	}).inputValidator({
		min:6,
		onError:"密码至少6位"
	});
		
})
//删除操作
function doDel(action_url){
	if(confirm("确定删除该条记录？")){
		redirect(action_url);
	}	
}

</script>
</block>	